package com.zmj.sy.mom.srv.aps.utils;

import com.zmj.sy.mom.srv.aps.bean.entity.order.OrderPhase;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class PhaseUtils {

    /**
     * 生成领料工序
     */
    public static OrderPhase genLingliaoPhase(Integer orderId, Integer bomId, String workChain,
                                              Integer phaseSeq, String plmId, String materName) {
        OrderPhase phase = new OrderPhase();
        phase.setWorkTime(0);
        phase.setOriWorkTime(phase.getWorkTime());
        phase.setPhaseCode(WorkshopProp.LL_PHASE_CODE);
        phase.setPhaseName(WorkshopProp.LL_PHASE_NAME);
        phase.setWorkGroupNumber(WorkshopProp.LL_GROUP);

        phase.setOrderId(orderId);
        phase.setBomId(bomId);
        phase.setWorkChain(workChain);
        phase.setPhaseSeq(phaseSeq);
        phase.setMaterNo(plmId);
        phase.setMaterName(materName);
        return phase;
    }

    /**
     * 生成库检工序
     */
    public static OrderPhase genKujianPhase(Integer orderId, Integer bomId, String workChain,
                                            Integer phaseSeq, String plmId, String materName) {
        OrderPhase phase = new OrderPhase();
        phase.setWorkTime(1);
        phase.setOriWorkTime(phase.getWorkTime());
        phase.setPhaseCode(WorkshopProp.KJ_PHASE_CODE);
        phase.setPhaseName(WorkshopProp.KJ_PHASE_NAME);
        phase.setWorkGroupNumber(WorkshopProp.KJ_GROUP);

        phase.setOrderId(orderId);
        phase.setBomId(bomId);
        phase.setWorkChain(workChain);
        phase.setPhaseSeq(phaseSeq);
        phase.setMaterNo(plmId);
        phase.setMaterName(materName);
        return phase;
    }

    /**
     * 生成委外工序
     */
    public static OrderPhase getWeiwaiPhase(Integer orderId, Integer bomId, String workChain,
                                            Integer phaseSeq, String plmId, String materName) {
        OrderPhase phase = new OrderPhase();
        phase.setWorkTime(1);
        phase.setOriWorkTime(phase.getWorkTime());
        phase.setPhaseCode("WW");
        phase.setPhaseName("委外");
        phase.setWorkGroupNumber("WW");

        phase.setOrderId(orderId);
        phase.setBomId(bomId);
        phase.setWorkChain(workChain);
        phase.setPhaseSeq(phaseSeq);
        phase.setMaterNo(plmId);
        phase.setMaterName(materName);

        return phase;
    }
}
